/**
 * 用状态机 管理autojs页面
 */
enum PACKAGE {
    KWAI = `com.smile.gifmaker`,
    NEBULA = `com.kuaishou.nebula`
}
class Core {
    node: AutoJs.UiObject;
    visit(visitor: Visitor, ctx: any) {
        return visitor.visit(this, ctx)
    }
    back(): boolean {
        return back()
    }
}
class Package extends Core {
    pkg: PACKAGE;
    pages: Page[] = [];
    current: Page;
    to(name: string) { }
    launch() {
        return launchPackage(this.pkg)
    }
}

class KwaiPackage extends Package { }
class NebulaPackage extends Package { }

abstract class Page extends Core {
    name: string;
    dialogs: Dialog[] = [];
    parent: Package;
    abstract to(page: string): boolean;
    abstract is(): boolean;
}

abstract class Dialog extends Core {
    abstract close(): void;
}

class TabLayoutPage extends Page {
    name: string = `TabLayout`
    current: Page;
    to(page: string): boolean {
        return false;
    }
    is(): boolean {
        return false;
    }
}
/**
 * 首页
 */
class HomePage extends Page {
    name: string = `Home`
    to(page: string): boolean {
        return false;
    }
    is(): boolean {
        return false;
    }
}
/**
 * 我的
 */
class MinePage extends Page {
    name: string = `Mine`
    to(page: string): boolean {
        return false;
    }
    is(): boolean {
        return false;
    }
}
/**
 * 精选
 */
class HotPage extends Page {
    name: string = `Hot`
    to(page: string): boolean {
        return false;
    }
    is(): boolean {
        return false;
    }
}
/**
 * 视频详情
 */
class PhotoPage extends Page {
    name: string = `Photo`
    to(page: string): boolean {
        return false;
    }
    is(): boolean {
        return false;
    }
}

/**
 * 直播广场
 */
class LiveListPage extends Page {
    name: string = `LiveList`
    to(page: string): boolean {
        return false;
    }
    is(): boolean {
        return false;
    }
}
/**
 * 关注
 */
class FollowPage extends Page {
    name: string = `Follow`
    to(page: string): boolean {
        return false;
    }
    is(): boolean {
        return false;
    }
}
/**
 * 直播详情
 */
class LivePage extends Page {
    name: string = `Live`
    to(page: string): boolean {
        return false;
    }
    is(): boolean {
        return false;
    }
}

interface Visitor {
    visit(Core: Core, ctx: any): any;
}


